import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import Home from "../views/Home";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/vue3",
    name: "vue3",
    component: Home,
    redirect: {
      name: "bilibili"
    },
    children: [
      {
        name: "bilibili",
        path: "bilibili",
        component: () =>
          import(
            /* webpackChunkName: "bilibili" */ "../views/bilibili/bilibili"
          ),
        redirect: {
          name: "animes"
        },
        children: [
          {
            name: "animes",
            path: "animes",
            component: () =>
              import(
                /* webpackChunkName: "animes" */ "../views/bilibili/animes/animes"
              )
          },
          {
            name: "servie",
            path: "servie",
            component: () =>
              import(
                /* webpackChunkName: "servie" */ "../views/bilibili/servie/servie"
              )
          }
        ]
      },
      {
        name: "douban",
        path: "douban",
        component: () =>
          import(
          /* webpackChunkName: "douban" */ "../views/douban/douban"
          ),
        redirect: {
          name: "movie"
        },
        children: [
          {
            name: "movie",
            path: "movie",
            component: () =>
              import(
                /* webpackChunkName: "movieStatistic" */ "../views/douban/movieStatistic"
              )
          }
        ]
      }
    ]
  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes
});

export default router;
